package com.newtouch.cq.base.starter.business.model.dto;
import com.newtouch.cq.base.starter.business.model.vo.BaseParentAble;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * 树节点
 */
@Data
@ApiModel("树节点")
public class TreeNode implements BaseParentAble<TreeNode> {
	private static final long serialVersionUID = -6612949873955747087L;
	@ApiModelProperty("节点标识")
	protected Long id;
	@ApiModelProperty("父节点标识")
    protected Long parentId;
	@ApiModelProperty("节点名称")
    protected String name;
	@ApiModelProperty("子节点集合")
    protected List<TreeNode> children = new ArrayList<TreeNode>();

    public void add(TreeNode node) {
        children.add(node);
    }

	@Override
	public void addChildEle(TreeNode child) {
		children.add(child);
	}

	@Override
	public void initialChildren() {
		children = new ArrayList<>();
	}
	
}
